﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model.Util;
using Xproject.Framework.Utility.Extensions;
using Xproject.Framework.Core.Repositories;
using Xproject.Framework.Utility.ExceptionHandling;
using Xproject.Framework.Core;
using System.Linq.Expressions;


namespace Repository.Util
{
   public static class IndexCategoryRep
    {
        public static List<IndexCategory> GetIndexCategoryList(this IRepositoryAsync<IndexCategory> repository)
        {
            Expression<Func<IndexCategory, bool>> express = i => 1 == 1;

            return repository.Query().Where(express).Select().OrderByDescending(i => i.Sort).ToList();
        }
        public static IndexCategory Get(this IRepositoryAsync<IndexCategory> repository,string IndexCateId)
        {
            Expression<Func<IndexCategory, bool>> express = i =>i.IndexCateId == IndexCateId;

            return repository.Query().Where(express).Select().OrderByDescending(i => i.Sort).FirstOrDefault();
        }

    }
}
